<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Ananas Library: Исходный файл adatabase.h</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Создано системой Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Титульная&nbsp;страница</span></a></li>
      <li><a href="annotated.html"><span>Классы</span></a></li>
      <li class="current"><a href="files.html"><span>Файлы</span></a></li>
    </ul>
  </div>
<h1>adatabase.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/****************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">** $Id: adatabase.h,v 1.51 2007/07/02 09:22:18 app Exp $</span>
<a name="l00003"></a>00003 <span class="comment">**</span>
<a name="l00004"></a>00004 <span class="comment">** Header file of the ananas database of Ananas</span>
<a name="l00005"></a>00005 <span class="comment">** Designer and Engine applications</span>
<a name="l00006"></a>00006 <span class="comment">**</span>
<a name="l00007"></a>00007 <span class="comment">** Created : 20031201</span>
<a name="l00008"></a>00008 <span class="comment">**</span>
<a name="l00009"></a>00009 <span class="comment">** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.</span>
<a name="l00010"></a>00010 <span class="comment">** Copyright (C) 2003-2005 Grigory Panov &lt;gr1313 at mail dot ru &gt;, Yoshkar-Ola</span>
<a name="l00011"></a>00011 <span class="comment">**</span>
<a name="l00012"></a>00012 <span class="comment">** This file is part of the Library of the Ananas</span>
<a name="l00013"></a>00013 <span class="comment">** automation accounting system.</span>
<a name="l00014"></a>00014 <span class="comment">**</span>
<a name="l00015"></a>00015 <span class="comment">** This file may be distributed and/or modified under the terms of the</span>
<a name="l00016"></a>00016 <span class="comment">** GNU General Public License version 2 as published by the Free Software</span>
<a name="l00017"></a>00017 <span class="comment">** Foundation and appearing in the file LICENSE.GPL included in the</span>
<a name="l00018"></a>00018 <span class="comment">** packaging of this file.</span>
<a name="l00019"></a>00019 <span class="comment">**</span>
<a name="l00020"></a>00020 <span class="comment">** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE</span>
<a name="l00021"></a>00021 <span class="comment">** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</span>
<a name="l00022"></a>00022 <span class="comment">**</span>
<a name="l00023"></a>00023 <span class="comment">** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru</span>
<a name="l00024"></a>00024 <span class="comment">** See http://www.leaderit.ru/gpl/ for GPL licensing information.</span>
<a name="l00025"></a>00025 <span class="comment">**</span>
<a name="l00026"></a>00026 <span class="comment">** Contact org@leaderit.ru if any conditions of this licensing are</span>
<a name="l00027"></a>00027 <span class="comment">** not clear to you.</span>
<a name="l00028"></a>00028 <span class="comment">**</span>
<a name="l00029"></a>00029 <span class="comment">**********************************************************************/</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef ADATABASE_H</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define ADATABASE_H</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#include &lt;qobject.h&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;qstringlist.h&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;qsqldatabase.h&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;qdict.h&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include "acfg.h"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;qwidget.h&gt;</span>
<a name="l00039"></a>00039 
<a name="l00044"></a>00044 <span class="preprocessor">#define db_document_header      "dh%1"</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define db_document_table       "dt%1_%2"</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#define db_catalog_element      "ce%1"</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#define db_catalog_group        "cg%1"</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define db_iregister            "ri%1"</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#define db_aregister            "ra%1"</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define db_areg_remainder       "ra%1_rem"</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define db_user_roles           "usr_rl"</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#define db_users                "usr"</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define db_roles                "rl"</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#define db_right_roles          "r_rl"</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#define db_indices              "idc"</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor">#define db_areg_dim             "ra%1_d%2"</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a>00058 <span class="keyword">class </span><a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>;
<a name="l00059"></a>00059 <span class="keyword">class </span><a class="code" href="classaCfgRc.html">aCfgRc</a>;
<a name="l00060"></a>00060 <span class="keyword">class </span><a class="code" href="classaDataTable.html" title="Определяет программный интерфейс модели данных...">aDataTable</a>;
<a name="l00061"></a>00061 <span class="comment">//class QDataSchema;</span>
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 
<a name="l00076"></a><a class="code" href="classaDatabase.html">00076</a> <span class="keyword">class  </span>ANANAS_EXPORT <a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>: <span class="keyword">public</span> QObject
<a name="l00077"></a>00077 {
<a name="l00078"></a>00078         Q_OBJECT
<a name="l00079"></a>00079 
<a name="l00080"></a>00080 <span class="keyword">public</span> slots:
<a name="l00081"></a>00081 <span class="keyword">public</span>:
<a name="l00090"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf">00090</a>         <span class="keyword">enum</span> <a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf" title="Перечисление поддерживаемых типов баз данных...">dbServer</a>
<a name="l00091"></a>00091         {
<a name="l00093"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acfee7018e6e2183ebebae54f2fe81119c4">00093</a>         unknown,
<a name="l00095"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acfa607e00e5c2386f9acc01e411a0648f7">00095</a>         mysql,
<a name="l00097"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf0602fcf93579fa8d14a377f82a2b1dad">00097</a>         postgresql,
<a name="l00099"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf1bac8b5dc8f97566683cca9d16231bc5">00099</a>         odbc,
<a name="l00101"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acfc5e7339d0fc4442eccad9a19cd26ecae">00101</a>         oracle,
<a name="l00103"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf650fe2c73d88cc3c399692cf8377aaae">00103</a>         mssql,
<a name="l00105"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf6639d371746aa70fb354091605c2f704">00105</a>         sybase };
<a name="l00106"></a>00106 
<a name="l00107"></a>00107         
<a name="l00115"></a><a class="code" href="classaDatabase.html#2a8a58fee86d82ee580b326a8b07a642">00115</a>         <a class="code" href="classaCfg.html" title="Класс реализует програмный интерфейс доступа...">aCfg</a> cfg;
<a name="l00116"></a>00116 
<a name="l00117"></a>00117         <a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>();
<a name="l00118"></a>00118         ~<a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>();
<a name="l00119"></a>00119         <span class="keywordtype">bool</span>            init( <a class="code" href="classaCfgRc.html">aCfgRc</a> *rc, <span class="keyword">const</span> QString &amp;dbname = QString::null );
<a name="l00120"></a>00120         <span class="keywordtype">bool</span>            init( <span class="keyword">const</span> QString &amp;rcname, <span class="keyword">const</span> QString &amp;dbname = QString::null );
<a name="l00121"></a>00121         <span class="keywordtype">bool</span>            prepareDatabaseConnect( <a class="code" href="classaCfgRc.html">aCfgRc</a> *rc );
<a name="l00122"></a>00122         <span class="keywordtype">void</span>            done();
<a name="l00123"></a>00123         QSqlDatabase*   db(<span class="keyword">const</span> QString &amp;dbname = QString::null );
<a name="l00124"></a>00124         <span class="keywordtype">bool</span>            checkStructure();
<a name="l00125"></a>00125         <span class="keywordtype">bool</span>            create();
<a name="l00126"></a>00126         <span class="keywordtype">bool</span>            drop( <span class="keyword">const</span> QString &amp;);
<a name="l00127"></a>00127         <span class="keywordtype">bool</span>            update();
<a name="l00128"></a>00128         Q_ULLONG        uid( <span class="keywordtype">int</span> otype );
<a name="l00129"></a>00129         <span class="keywordtype">int</span>             uidType ( Q_ULLONG uid );
<a name="l00130"></a>00130         <a class="code" href="classaDataTable.html" title="Определяет программный интерфейс модели данных...">aDataTable</a>*     table( <span class="keyword">const</span> QString &amp; name = QString::null );
<a name="l00131"></a>00131         <span class="keywordtype">bool</span>            tableExists( <span class="keyword">const</span> QString &amp; name );
<a name="l00132"></a>00132         <span class="keywordtype">void</span>            markDeleted(Q_ULLONG uid);
<a name="l00133"></a>00133         <span class="keywordtype">void</span>            deleteMarked();
<a name="l00134"></a>00134         QString         driverName();
<a name="l00135"></a>00135 
<a name="l00136"></a>00136         <span class="keyword">static</span> QStringList      supportedDriverList();
<a name="l00137"></a>00137         <span class="keyword">static</span> QStringList      getUniqueIndices(<span class="keyword">const</span> QString &amp; flddef);
<a name="l00138"></a>00138         <span class="keyword">static</span> QString          tableDbName( <a class="code" href="classaCfg.html" title="Класс реализует програмный интерфейс доступа...">aCfg</a> &amp;md, aCfgItem context, <span class="keywordtype">long</span> * tid);
<a name="l00139"></a>00139         <span class="keyword">static</span> QString          tableDbName( <a class="code" href="classaCfg.html" title="Класс реализует програмный интерфейс доступа...">aCfg</a> &amp;md, aCfgItem context);
<a name="l00140"></a>00140 
<a name="l00141"></a>00141         <span class="keywordtype">bool</span> exchangeDataSystables       ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00142"></a>00142         <span class="keywordtype">bool</span> exchangeDataCatalogues      ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00143"></a>00143         <span class="keywordtype">bool</span> exchangeDataDocuments       ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00144"></a>00144         <span class="keywordtype">bool</span> exchangeDataJournals        ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00145"></a>00145         <span class="keywordtype">bool</span> exchangeDataInfoRegisters   ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00146"></a>00146         <span class="keywordtype">bool</span> exchangeDataAccumulationRegisters   ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00147"></a>00147         <span class="keywordtype">bool</span> exchangeDataUniques         ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00148"></a>00148 
<a name="l00149"></a>00149 
<a name="l00150"></a>00150 <span class="keyword">private</span>:
<a name="l00158"></a>00158         QSqlDatabase *dataBase;
<a name="l00159"></a>00159 
<a name="l00160"></a>00160         <span class="keywordtype">bool</span> exportTableData(QDomDocument&amp; xml, <span class="keyword">const</span> QString &amp;tableName);
<a name="l00161"></a>00161         <span class="keywordtype">bool</span> importTableData(QDomDocument&amp; xml, <span class="keyword">const</span> QString &amp;tableName);
<a name="l00162"></a>00162         <span class="keywordtype">void</span> reportError(QSqlError er, <span class="keyword">const</span> QString &amp;query);
<a name="l00163"></a>00163 
<a name="l00164"></a>00164         QString fieldtype( <span class="keyword">const</span> QString &amp;tdef );
<a name="l00165"></a>00165         <span class="keywordtype">void</span> checkIndices(<span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QString &amp;flddef, QStringList &amp;ui_add, QStringList &amp;ui_drop);
<a name="l00166"></a>00166         <span class="keywordtype">bool</span> isExists(<span class="keyword">const</span> QString fname, QStringList *f_lst, QString &amp;match);
<a name="l00167"></a>00167         QString fieldsDef( aCfgItem context, <span class="keyword">const</span> QString &amp;idx=QString::null);
<a name="l00168"></a>00168         QString sysFieldsDef ( aCfgItem context );
<a name="l00169"></a>00169         QString convFieldsDef( <span class="keyword">const</span> QString flddef, QString &amp;idxdef, QString &amp;pkey );
<a name="l00170"></a>00170         <span class="keywordtype">bool</span> createdb( <span class="keywordtype">bool</span> update );
<a name="l00171"></a>00171         <span class="keywordtype">bool</span> createIndexes(<span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QString &amp;indexl, <span class="keyword">const</span> QStringList &amp; uidc=QStringList());
<a name="l00172"></a>00172         <span class="keywordtype">bool</span> dropIndexes(<span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QStringList &amp;indices=QStringList());
<a name="l00173"></a>00173         <span class="keywordtype">bool</span> verifyTable( <span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QString &amp;flddef,
<a name="l00174"></a>00174         QString &amp;f_drop, QString &amp;f_add, QString &amp;f_upd,
<a name="l00175"></a>00175         QString &amp;i_drop, QString &amp;i_add, QStringList &amp; ui_drop, QStringList &amp; ui_add);
<a name="l00176"></a>00176         <span class="keywordtype">bool</span> createTable(<span class="keywordtype">int</span> update, <span class="keyword">const</span> QString table, QString flddef );
<a name="l00177"></a>00177         <span class="keywordtype">bool</span> createSystables( <span class="keywordtype">bool</span> update );
<a name="l00178"></a>00178         <span class="keywordtype">bool</span> createCatalogues( <span class="keywordtype">bool</span> update );
<a name="l00179"></a>00179         <span class="keywordtype">bool</span> createDocuments( <span class="keywordtype">bool</span> update );
<a name="l00180"></a>00180         <span class="keywordtype">bool</span> createJournals( <span class="keywordtype">bool</span> update );
<a name="l00181"></a>00181         <span class="keywordtype">bool</span> createInformationRegisters( <span class="keywordtype">bool</span> update );
<a name="l00182"></a>00182         <span class="keywordtype">bool</span> createAccumulationRegisters( <span class="keywordtype">bool</span> update );
<a name="l00183"></a>00183         <span class="keywordtype">bool</span> createARegisters( <span class="keywordtype">bool</span> update );
<a name="l00184"></a>00184         <span class="keywordtype">bool</span> dumpTable( QDomDocument&amp; xml, <span class="keyword">const</span> QString &amp;tableName);
<a name="l00185"></a>00185         <span class="keywordtype">void</span> fillFeatures();
<a name="l00186"></a>00186         QString feature(<span class="keyword">const</span> QString&amp; fetureName);
<a name="l00187"></a>00187 
<a name="l00188"></a>00188         QMap&lt;QString, QString&gt; featuresMySQL, featuresSQLite, featuresPostgreSQL;
<a name="l00189"></a>00189 
<a name="l00190"></a>00190 };
<a name="l00191"></a>00191 
<a name="l00192"></a>00192 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Документация по Ananas Library. Последние изменения: Sun Feb 1 21:47:14 2009. Создано системой&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
